import request from '@/utils/request'

export function addRole(data) {
    return request({
        url: '/api/admin/role/add',
        method: 'post',
        data
    })
}
export function delRole(roleId) {
    return request({
        url: `/api/admin/role/delete/${roleId}`,
        method: 'delete',
    })
}
export function editRole(data) {
    return request({
        url: '/api/admin/role/update',
        method: 'put',
        data
    })
}
export function roleList(query = {}) {
    return request({
        url: '/api/admin/role/list',
        method: 'post',
        data: query
    })
}
export function roleGetPermissions(roleId) {
    return request({
        url: `/api/admin/role/permissions/${roleId}`,
        method: 'get',
    })
}

export function roleAssignPermissions(data = {}) {
    return request({
        url: '/api/admin/role/assignPermissions',
        method: 'post',
        data
    })
}
// 获取所有角色
export function getAllRole() {
    return request({
        url: `/api/admin/role/all`,
        method: 'get',
    })
}
